package com.gk.study.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gk.study.entity.BClassification;
import com.gk.study.mapper.BClassificationMapper;
import com.gk.study.service.IBClassificationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jingyan
 * @since 2024-07-06
 */
@Service
public class BClassificationServiceImpl extends ServiceImpl<BClassificationMapper, BClassification> implements IBClassificationService {
    @Autowired
    BClassificationMapper mapper;

    @Override
    public List<BClassification> getClassificationList() {
        return mapper.selectList(new QueryWrapper<>());
    }

    @Override
    public void createClassification(BClassification classification) {
        System.out.println(classification);
        classification.setCreateTime(LocalDateTime.now());
        mapper.insert(classification);
    }

    @Override
    public void deleteClassification(String id) {
        mapper.deleteById(id);
    }

    @Override
    public void updateClassification(BClassification classification) {
        mapper.updateById(classification);
    }
}

//BClassificationServiceImpl 类负责处理与 BClassification 实体相关的业务逻辑。使用 MyBatis-Plus 提供的通用方法和自定义的方法来完成 CRUD 操作
